home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
- +
- + LEDA 2.1.1 11-15-1991
- +
- +
- + subdivision.h
- +
- +
- + Copyright (c) 1991 by Max-Planck-Institut fuer Informatik
- + Im Stadtwald, 6600 Saarbruecken, FRG
- + All rights reserved.
- +
- *******************************************************************************/
-
-
-
-
- #ifndef SUBDIVISIONH
- #define SUBDIVISIONH
-
- // We use plane sweep & persistent dictionary
-
- #include <LEDA/plane.h>
- #include <LEDA/plane_alg.h>
- #include <LEDA/planar_map.h>
- #include <LEDA/p_dictionary.h>
- #include <LEDA/sortseq.h>
-
- int compare(segment& s1, segment& s2);
-
- declare2(p_dictionary,segment,face)
- typedef p_dictionary(segment,face) strip;
-
- declare2(sortseq,real,strip)
- typedef sortseq(real,strip) strip_list;
-
-
- class SubDivision : public planar_map
- {
- face outer_face;
- strip_list strips;
-
- public:
-
- SubDivision(const graph&);
-
- ~SubDivision() {}
-
- point position(node v) const { return point(inf(v)); }
-
- face locate_point(point) const;
-
- void print_stripes() const;
-
- };
-
-
- //------------------------------------------------------------------------------
- //
- // subdivision(ftype): generic subdivisions with face entries of type "ftype"
- //
- //------------------------------------------------------------------------------
-
- #define subdivision(ftype) name2(ftype,subdivision)
-
- #define subdivisiondeclare(ftype)\
- \
- class subdivision(ftype) : public SubDivision {\
- \
- void copy_face_entry(ent& x) const { x = Copy(*(ftype*)&x); }\
- \
- void clear_face_entry(ent& x) const { Clear(*(ftype*)&x); }\
- \
- public:\
- \
- ftype inf(face f) const { return ftype(SubDivision::inf(f)); }\
- point operator[](node v) const { return point(SubDivision::inf(v)); }\
- ftype operator[](face f) const { return ftype(SubDivision::inf(f)); }\
- \
- void print_node(node v) const { cout << "[" << index(v) <<"] (";\
- Print(position(v));\
- cout << ") ";}\
- \
- subdivision(ftype)(GRAPH(point,ftype)& G) : SubDivision((graph&)G) {}\
- ~subdivision(ftype)() {}\
- \
- };
-
- #endif SUBDIVISIONH
-